using Microsoft.AspNetCore.Mvc;
using Zhaoxi.MSACommerce.HttpApi.Common.Infrastructure;
using Zhaoxi.MSACommerce.ProductService.UseCases.Queries;

namespace Zhaoxi.MSACommerce.ProductService.HttpApi.Controllers;
[Route("api/product")]
[ApiController]
public class ProductController:ApiControllerBase
{
    [HttpGet]
    public async Task<IActionResult> GetProduct(long id)
    {
        var result = await Sender.Send(new GetSpuFullQuery(id));
        return ReturnResult(result);
    }
    
    [HttpPost("sku/list")]
    public async Task<IActionResult> GetSkuList([FromBody] long[] skuIds)
    {
        var result = await Sender.Send(new GetSkuListByIdsQuery(skuIds));
        return ReturnResult(result);
    }
    
}